package fileIO;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class Demo3_InputStream {
    public static void main(String[] args) throws IOException {
        InputStream input = null;
        try{
            input = new FileInputStream("./test.txt");
        }finally {
            input.close();
        }
        // try with resource
        try(InputStream input1 = new FileInputStream("./test.txt");
//            InputStream input2 = new FileInputStream("./test.txt");
//            InputStream input3 = new FileInputStream("./test.txt")
        ) {
            while (true) {
                int data = input1.read();
                if (data == -1) break;
                System.out.printf("%c",data);
            }
        }
    }
}
